package Boundry;

import java.awt.Dimension;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.awt.BorderLayout;
import java.awt.Toolkit;
import java.awt.SystemColor;
import java.awt.Color;
import java.awt.GridLayout;
import javax.swing.border.LineBorder;

import Controllers.GlobalData;
import Controllers.GuiManager;
import Controllers.UsersManager;
import javax.swing.SwingConstants;
import java.awt.Font;

public class LoadingScreen extends JFrame implements ActionListener {

	/**
	 * @param args
	 */

	JLabel lbl_Info;

	private static final long serialVersionUID = 1L;

	
	
	
public LoadingScreen() {
    
   //  this.setSize(150, 200);
     
    setEnabled(false);
  	setAlwaysOnTop(true);
  	this.setUndecorated(true);
  	this.setSize(150, 140);
  	
  	Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
  	
  	int w = this.getSize().width;
     int h = this.getSize().height;
     int x = (dim.width-w)/2;
     int y = (dim.height-h)/2;

     // Move the window
     this.setLocation(x, y);
  	
 	setIconImage(Toolkit.getDefaultToolkit().getImage(Splash.class.getResource("/GUI/Image/12_hardware_dock.png")));
  	getContentPane().setLayout(new GridLayout(0, 1, 0, 0));
  	
  	JPanel panel = new JPanel();
  	panel.setBorder(null);
  	panel.setBackground(new Color(0, 255, 0, 0));
  	getContentPane().add(panel);
  	panel.setLayout(null);
  	
  	JLabel lblNewLabel_1 = new JLabel("");
  	lblNewLabel_1.setBounds(118, 91, 48, 55);
  	lblNewLabel_1.setIcon(new ImageIcon(Splash.class.getResource("/ICONS/bigrotation2.gif")));
  	panel.add(lblNewLabel_1);
  	
  	lbl_Info = new JLabel("Connecting to Database", JLabel.CENTER);
  	lbl_Info.setFont(new Font("Tahoma", Font.BOLD, 11));
  	lbl_Info.setForeground(new Color(47, 79, 79));
  	lbl_Info.setBounds(22, 152, 233, 14);
  	panel.add(lbl_Info);
    
     this.addWindowListener(closeWindow);
   // this.setO.setOpaque(false);
     setVisible(true);
     toFront();
     //setBackground(new Color(0, 255, 0, 0));
 }

 
 public void actionPerformed(ActionEvent ae) {
     System.exit(0);
 }
  
 private static WindowListener closeWindow = new WindowAdapter(){
  
	 public void windowClosing(WindowEvent e){
         e.getWindow().dispose();
     }
 };
  
 
 public static void main (String args[]) {
	 
     LoadingScreen ls = new LoadingScreen();
     
   
     
      
 }
 
	/*
	public void setInfo(String lbl_Info) {	
		this.lbl_Info.setText(lbl_Info); 		
	}

	{
        setOpaque(false);
   
	}
    public void paintComponent(JPanel pane) {
    	pane.setBackground();
        Rectangle r = pane.getClipBounds();
        g.fillRect(r.x, r.y, r.width, r.height);
        super.paintComponent(g);
    }
 */
 
}
	       

